using System;
using System.Collections.Generic;
using System.Text;

namespace Chan_cli.Modules
{
    class RootModule : Module
    {

        // Constructor
        public RootModule() { }

        // Path Exist?
        public override bool PathExist(string[] Path)
        {
            return true;
        }

        // Request, sir!
        public override byte[] Request(string[] Path)
        {

            // Don't care for path.

            // Go!
            string HTML = string.Empty;
            HTML += "<html>\r\n<head>\r\n\t<title>notp2pchan</title>\r\n</head>\r\n";
            HTML += "<frameset cols=\"200,100%\">\r\n";
            HTML += "\t<frame src=\"/sidebar/\" name=\"sidebar\" />\r\n";
            HTML += "\t<frame src=\"/files/index.html\" name=\"main\" />\r\n";
            HTML += "</frameset>\r\n";

            return ASCIIEncoding.ASCII.GetBytes(HTML);

        }
        
        // Request, but with data; ooo!
        public override byte[] RequestData(string[] Path, POSTData[] Data)
        {
        
        	// Module's simple, can't be affected by Data, so just serve a regular page
        	return Request(Path);
        
        }

    }
}
